//
// Created by Zemon on 2024/11/2.
//

#include "catch.h"
#include "remote_control.h"
#include "main.h"

extern TIM_HandleTypeDef htim8;
extern RC_ctrl_t rc_ctrl;
int16_t angle_delta1;
int16_t angle_now1 = 800;

void catch_init(void)
{
   __HAL_TIM_SetCompare(&htim8,TIM_CHANNEL_1,800);
}

void catch_control(void)
{
    angle_delta1 = rc_ctrl.rc.ch[4]/66;
    angle_now1 = angle_now1 + angle_delta1;
    if (angle_now1<=200)
        angle_now1 = 200;
    else if(angle_now1>=1100)
        angle_now1 = 1100;
    else
        angle_now1 = angle_now1;
    __HAL_TIM_SetCompare(&htim8,TIM_CHANNEL_1,angle_now1);

}